Skip to main content

onPostPublish

Callback to receive the data published from the editor. This callback is available in both createPost and editPost methods and is triggered when the user clicks the "Publish" button inside the editor interface.

Usage

With createPost:

predis.createPost({
onPostPublish: function (error, data) {
if (error) {
console.error("Error publishing new post:", error);
} else {
console.log("New post published successfully:", data);
}
},
});

With editPost:

predis.editPost({
post_id: "YOUR_POST_ID",
onPostPublish: function (error, data) {
if (error) {
console.error("Error publishing edited post:", error);
} else {
console.log("Edited post published successfully:", data);
}
},
});

Parameters

NameDescriptionTypeRequired
errorError triggered when the post failed to publish otherwise nullErroryes
dataThe data of the published post inthe format given below.Objectyes
data.media_urlAn array containing URL(s) of the published media. This can be a URL for a jpeg or mp4 file.
In case when data.media_type is single_image or video the array will contain only one item, while in case of carousel it can contain multiple items.
Arrayyes
data.post_idAn unique ID to identify the published post.Stringyes
data.thumb_urlAn URL for the thumbnail of the published media.Stringyes
data.media_typeMedia type of the published media. Can be one of single_image, carousel or videoStringyes
data.captionCaption of the generated content.Stringyes